package com.lgCore.cocurrent;


import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 连接池
 */
@Slf4j
public class ExecutorScheduler {
    private static int N_CPUS = Runtime.getRuntime().availableProcessors();
    private static ExecutorService pool = Executors.newFixedThreadPool(N_CPUS);
    /**
     * 添加任务
     *
     * @param executeTask
     */
    public static void add(Callable executeTask) {
        pool.submit(executeTask);
    }
}
